package com.ygqh.baby.model;

import com.ygqh.baby.ao.RebateType;
import com.ygqh.baby.constant.Constant;

import java.math.BigDecimal;

public class BalanceDetailForTask {

	private Long orderDetailId;

	private Long supplierId;

	private String orderId;

	private BigDecimal sharePrice;

	private String productName;

	private BigDecimal shareRate;

	private BigDecimal foreverRate;

	public BalanceDetailForTask() {
		super();
	}

	public BalanceDetailForTask(Long orderDetailId, Long supplierId, String orderId, BigDecimal sharePrice, String productName, BigDecimal shareRate,
			BigDecimal foreverRate) {
		super();
		this.orderDetailId = orderDetailId;
		this.supplierId = supplierId;
		this.orderId = orderId;
		this.sharePrice = sharePrice;
		this.productName = productName;
		this.shareRate = shareRate;
		this.foreverRate = foreverRate;
	}

	public BigDecimal getBalancePrice(RebateType rebateType, String platformNo) {
		return sharePrice.multiply(getRate(rebateType, platformNo)).setScale(1, BigDecimal.ROUND_HALF_UP);
	}

	public BigDecimal getRate(RebateType rebateType, String platformNo) {
		if (Constant.YIJIADIAN_PLATFORM_NO.equals(platformNo)) {
			return shareRate;
		}
		if (rebateType.equals(RebateType.Share)) {
			return shareRate;
		}
		return foreverRate;
	}

	public Long getSupplierId() {
		return supplierId;
	}

	public void setSupplierId(Long supplierId) {
		this.supplierId = supplierId;
	}

	public BigDecimal getShareRate() {
		return shareRate;
	}

	public void setShareRate(BigDecimal shareRate) {
		this.shareRate = shareRate;
	}

	public BigDecimal getForeverRate() {
		return foreverRate;
	}

	public void setForeverRate(BigDecimal foreverRate) {
		this.foreverRate = foreverRate;
	}

	public BigDecimal getSharePrice() {
		return sharePrice;
	}

	public void setSharePrice(BigDecimal sharePrice) {
		this.sharePrice = sharePrice;
	}

	public Long getOrderDetailId() {
		return orderDetailId;
	}

	public void setOrderDetailId(Long orderDetailId) {
		this.orderDetailId = orderDetailId;
	}

	public String getOrderId() {
		return orderId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}

	public String getProductName() {
		return productName;
	}

	public void setProductName(String productName) {
		this.productName = productName;
	}

}
